<{include file="app/header.tpl"}>

<form action="" method="POST" class="order-wrap" onSubmit="return order_pay(this)">

	<div class="pay" id="buy-payment">
	    <p class="title">支付方式</p>
	    <div class="payInfo-wrap fix">
	        <{foreach from=$payment item="p" name="payment"}>
	        <label class="payInfo fix">
	            <img src="<{$p.iconUrl}>" class="img" alt="">
	            <span class="text"><{$p.name}></span>
	                <input type="radio" name="paymentId" paytype="<{$p.name}>" value="<{$p.id}>" class="radio" <{if $smarty.foreach.payment.index == 0}>checked="checked"<{/if}>>
	        </label>
	        <{/foreach}>
	     </div>
	</div>

    <div class="order-fee-details">
        <br/>
        <input type="submit" class="submitBtn" name="submit_op" value="立即支付">
    </div>

</form>

<script>
// 支付函数
function order_pay (formItem)
{
    var paytype = $(formItem).find('input[name=paymentId]:checked').attr('paytype');

    // alipay
    if (paytype == '支付宝')
    {
        app_client_alipay('<{$order.orderNo}>', '<{$order.shortTitle}>', '<{$order.title}>', '<{$order.moneyTotal/100|number_format:2}>', 'http://www.youzigouwu.com/payment/alipay/notify');
    }
    else
    // wechat
    {
        app_client_wechatpay('<{$order.orderNo}>', '<{$order.shortTitle}>', '<{$order.title}>', '<{$order.moneyTotal/100|number_format:2}>', 'http://www.youzigouwu.com/payment/weixin/notify');
    }

    return false;
}

</script>

<{include file="app/footer.tpl"}>
